home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5624 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  48 lines

  1. Path: news.tamu.edu!news
  2. From: Clint Chapman <bubbac@tamu.edu>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Converting integer to char/string?
  5. Date: 5 Feb 1996 23:12:11 GMT
  6. Organization: Texas A&M University, College Station, TX
  7. Message-ID: <4f62sb$gc4@news.tamu.edu>
  8. References: <4f5sj8$5f8@news1.usa.pipeline.com>
  9. NNTP-Posting-Host: jdw.tamu.edu
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; AIX 2)
  14. X-URL: news:4f5sj8$5f8@news1.usa.pipeline.com
  15.  
  16. The header is "stdlib.h" and the function is 
  17.  
  18. char *itoa(int num, const char *, int radix);
  19.  
  20. This program displays the value of 1423 in hexadecimal (58F)
  21.  
  22. #include <stdlib.h>
  23. #include <stdio.h>
  24.  
  25. void main(void)
  26. {
  27.     char p[20];
  28.     itoa(1423,p,16);
  29.     printf(p);
  30. }
  31. ..
  32.  
  33. This was taken from "C The Complete Reference" 2nd ed. by H. Schildt, 1990.
  34.  
  35. Hope this helped.  BTW, at the time this book was published, its kinda old, it
  36. was not part of the ANSI standard, but is found in most compiliers.
  37.  
  38. Clint Chapman
  39. -- 
  40. ___________________________________________________________________
  41.     Clinton Chapman - Graduate Assistant Researcher
  42.     Texas A&M University - Department of Aerospace Engineering
  43.     Email: bubbac@tamu.edu - (409)845-0745 , (409)862-4265
  44.     FAX: (409)845-6051
  45.     Homepage: http://www.isc.tamu.edu/~clint
  46. ___________________________________________________________________
  47.  
  48.